package windows;

import java.awt.Dimension;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SpringLayout;

public class ActionFrame {
	private JFrame frame;
	private JButton addWorkerButton = new JButton("Adauga angajat");
	private JButton removeWorkerButton = new JButton("Sterge angajat");
	private JButton modifyWorkersButton = new JButton("Vizualizare angajati");
	private JButton reportGeneratorButton = new JButton("Genereaza rapoarte");
	private boolean openedFirstTime=true;

	
	public void setFrame() {
		frame = new JFrame();
		JPanel panel = new JPanel();
		SpringLayout layout = new SpringLayout();
		panel.setLayout(layout);

		addWorkerButton.setPreferredSize(new Dimension(150, 30));
		removeWorkerButton.setPreferredSize(new Dimension(150, 30));
		reportGeneratorButton.setPreferredSize(new Dimension(150, 30));
		modifyWorkersButton.setPreferredSize(new Dimension(150, 30));

		addWorkerButton.setActionCommand("addAngajatCommand");
		removeWorkerButton.setActionCommand("removeAngajatcommand");
		modifyWorkersButton.setActionCommand("modifyAngajatiCommand");
		reportGeneratorButton.setActionCommand("reportGeneratorCommand");

		panel.add(addWorkerButton);
		panel.add(removeWorkerButton);
		panel.add(reportGeneratorButton);
		panel.add(modifyWorkersButton);

		layout.putConstraint(SpringLayout.WEST, addWorkerButton, 110,
				SpringLayout.WEST, panel);
		layout.putConstraint(SpringLayout.NORTH, addWorkerButton, 30,
				SpringLayout.NORTH, panel);

		layout.putConstraint(SpringLayout.WEST, removeWorkerButton, 110,
				SpringLayout.WEST, panel);
		layout.putConstraint(SpringLayout.NORTH, removeWorkerButton, 5,
				SpringLayout.SOUTH, addWorkerButton);

		layout.putConstraint(SpringLayout.WEST, modifyWorkersButton, 110,
				SpringLayout.WEST, panel);
		layout.putConstraint(SpringLayout.NORTH, modifyWorkersButton, 5,
				SpringLayout.SOUTH, removeWorkerButton);

		layout.putConstraint(SpringLayout.WEST, reportGeneratorButton, 110,
				SpringLayout.WEST, panel);
		layout.putConstraint(SpringLayout.NORTH, reportGeneratorButton, 5,
				SpringLayout.SOUTH, modifyWorkersButton);

		frame.setSize(400, 300);
		frame.setResizable(false);
		frame.getContentPane().add(panel);

	}

	public JFrame getFrame() {
		return frame;
	}

	public JButton getAddWorkerButton() {
		return addWorkerButton;
	}

	public JButton getRemoveWorkerButton() {
		return removeWorkerButton;
	}

	public JButton getModifyWorkersButton() {
		return modifyWorkersButton;
	}

	public JButton getReportGeneratorButton() {
		return reportGeneratorButton;
	}
	public boolean isOpenedFirstTime() {
		return openedFirstTime;
	}

	public void setOpenedFirstTime(boolean openedFirstTime) {
		this.openedFirstTime = openedFirstTime;
	}




	public void dispose() {
		frame.dispose();
		
	}

	public void showFrame() {
		frame.setVisible(true);
	}

	public void hideFrame() {
	frame.dispose();
		
	}

	
}